package com.kjlink.internal.report4vue.plan.model;


import cn.xuqiudong.common.base.model.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.kjlink.internal.report4vue.base.json.DynamicBigDecimalSerializer;
import com.kjlink.internal.workreport.base.annotation.NoneColumn;
import com.kjlink.internal.workreport.base.enums.PlanStatusEnum;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;


/**
 * 计划管理  实体类
 *
 * @author Vic.xu
 */
public class Plan extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate date;

    /**
     * 项目id
     */
    private Integer projectId;

    @NoneColumn
    private String projectName;

    /**
     * 用户id
     */
    private Integer userId;

    @NoneColumn
    private String userName;

    /**
     * jira号
     */
    private String jira;

    /**
     * 预计工时:小时
     */
    @JsonSerialize(using = DynamicBigDecimalSerializer.class)
    private BigDecimal duration;

    /**
     * 备注
     */
    private String note;

    /**
     * 状态
     */
    private PlanStatusEnum status;

    /**
     * 完成日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date completionDate;


    /***************** set|get  start **************************************/
    /**
     * set：日期
     */
    public Plan setDate(LocalDate date) {
        this.date = date;
        return this;
    }

    /**
     * get：日期
     */
    public LocalDate getDate() {
        return date;
    }

    /**
     * set：项目id
     */
    public Plan setProjectId(Integer projectId) {
        this.projectId = projectId;
        return this;
    }

    /**
     * get：项目id
     */
    public Integer getProjectId() {
        return projectId;
    }

    /**
     * set：用户id
     */
    public Plan setUserId(Integer userId) {
        this.userId = userId;
        return this;
    }

    /**
     * get：用户id
     */
    public Integer getUserId() {
        return userId;
    }

    /**
     * set：jira号
     */
    public Plan setJira(String jira) {
        this.jira = jira;
        return this;
    }

    /**
     * get：jira号
     */
    public String getJira() {
        return jira;
    }

    /**
     * set：预计工时:小时
     */
    public Plan setDuration(BigDecimal duration) {
        this.duration = duration;
        return this;
    }

    /**
     * get：预计工时:小时
     */
    public BigDecimal getDuration() {
        return duration;
    }

    /**
     * set：备注
     */
    public Plan setNote(String note) {
        this.note = note;
        return this;
    }

    /**
     * get：备注
     */
    public String getNote() {
        return note;
    }

    /**
     * set：状态
     */
    public Plan setStatus(PlanStatusEnum status) {
        this.status = status;
        return this;
    }

    /**
     * get：状态
     */
    public PlanStatusEnum getStatus() {
        return status;
    }

    /**
     * set：完成日期
     */
    public Plan setCompletionDate(Date completionDate) {
        this.completionDate = completionDate;
        return this;
    }

    /**
     * get：完成日期
     */
    public Date getCompletionDate() {
        return completionDate;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    /***************** set|get  end **************************************/

    public String getStatusText() {
        return status == null ? "" : status.getText();
    }
}
